<?php
$link=mysqli_connect("localhost","root","root","2113");
$sql="SELECT COUNT(*) AS c FROM addnews";
$res=mysqli_query($link,$sql);
$one=mysqli_fetch_assoc($res);
$total=$one['c'];
$perpage=5;
$p=ceil($total/$perpage);
$arr['p']=$p;
echo json_encode($arr);

?>